package app.remote;

import java.io.IOException;

import javax.websocket.OnMessage;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

import com.jfinal.core.Controller;

@ServerEndpoint("/websocket")
public class RemoteServer {
		@OnMessage
		public void receiveUser(String message,Session session){
			System.out.println("Received:"+message);
			try
			{
				session.getBasicRemote().sendText("This is the first server message");
				session.getBasicRemote().sendText("this is the last server message");
			} catch (IOException e)
			{
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		public void onOpen(){
			System.out.println("client connected");
		}
		public void onClose(){
			System.out.println("connection closed");
		}
}
